<template>
  <div id="window8">
    <!-- 头部：标题 -->
    <div style="padding: 5px">
      <el-row>
        <!--        标题-->
        <el-col :span="17" style="text-align: right;">矛盾纠纷七日数据统计</el-col>
        <!--        关闭按钮-->
        <el-col :span="7" style="text-align: right;">
          <div>
            <el-popconfirm title="是否关闭该窗口" @confirm="closeWindow">
              <template #reference>
                <el-icon>
                  <CircleClose/>
                </el-icon>
              </template>
            </el-popconfirm>
          </div>
        </el-col>
      </el-row>
    </div>

    <!-- 次标题 -->
    <div style="text-align: left; padding-left: 10px">
      <div>状态：已调节</div>
      <div>时间段：2018-06-10至2018-06-14</div>
    </div>

    <!-- 主体：柱状图 -->
    <div ref="chart" style="width: 90%; height: 320px;margin-left: 30px"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts';
import {defineComponent} from "vue";
import { defineEmits } from 'vue'

const emit = defineEmits()

const closeWindow = () => {
  emit('closeWindow')
}
// 柱状图
export default defineComponent({
  data() {
    return {
      chart: null,
    };
  },
  mounted() {
    this.chart = echarts.init(this.$refs.chart);
    this.renderChart();
  },
  methods: {
    renderChart() {

      const option = {
        xAxis: {
          type: 'category',
          boundaryGap: false,
          data: ['06-08', '06-09', '06-10', '06-11', '06-12', '06-13', '06-14']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [121, 132, 97, 153, 129, 167, 171],
            type: 'line',
            areaStyle: {}
          }
        ]
      };

      this.chart.setOption(option);
    },
  },
})
</script>

<style scoped>
.title {
  margin-right: auto;
}

.button {
  margin-left: auto;
}

</style>
